package com.skyz.wrap.entity.result;

import android.text.TextUtils;

import com.skyz.wrap.utils.BigDecimalUtil;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Map;

public class UserInfoDetail implements Serializable {


    /**
     * nickname : 用户14d86a
     * avatar : https://skyzcom.oss-cn-hangzhou.aliyuncs.com/crmebimage/public/operation/2021/12/25/0427b90c74b64a03ae3e7e5c628ef7d69038aimgou.jpg
     * phone : 13786102900
     * nowMoney : 0.0000
     * integral : 12401.2200
     * experience : 0
     * brokeragePrice : 0.00
     * level : 0
     * isPromoter : false
     * couponCount : 0
     * vip : false
     * vipIcon : null
     * vipName : null
     * rechargeSwitch : false
     * collectCount : 1
     * inviteCode : bcdefg
     * teamCode : l-bcdefg
     * wool : 25322.1500
     * hasSafePwd : true
     * isCertify : true
     * isLocationOk : false
     * busType : 1
     */

    private String nickname;
    private String avatar;
    private String phone;
    private String nowMoney;
    private String integral;
    private int experience;
    private String brokeragePrice;
    private int level;
    private boolean isPromoter;
    private int couponCount;
    private boolean vip;
    private Object vipIcon;
    private String vipName;

    private String starLevelName;

    private boolean rechargeSwitch;
    private int collectCount;
    private String inviteCode;
    private String teamCode;
    private String wool;
    private boolean hasSafePwd;
    private boolean isCertify;
    private boolean isLocationOk;
    private String realName;

    private String contribution;

    public String getRealName() {
        if (TextUtils.isEmpty(realName)){
            return nickname;
        }
        return  realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    /**
     * 业务类型(用户类型)：1-个人、21-市级合伙人、22-县级合伙人、3-商家
     */
    private int busType;

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getNowMoney() {
        return nowMoney;
    }

    public void setNowMoney(String nowMoney) {
        this.nowMoney = nowMoney;
    }

    public String getIntegral() {
        return BigDecimalUtil.formatZero(integral);
    }

    public void setIntegral(String integral) {
        this.integral = integral;
    }

    public int getExperience() {
        return experience;
    }

    public void setExperience(int experience) {
        this.experience = experience;
    }

    public String getBrokeragePrice() {
        return brokeragePrice;
    }

    public void setBrokeragePrice(String brokeragePrice) {
        this.brokeragePrice = brokeragePrice;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public boolean isIsPromoter() {
        return isPromoter;
    }

    public void setIsPromoter(boolean isPromoter) {
        this.isPromoter = isPromoter;
    }

    public int getCouponCount() {
        return couponCount;
    }

    public void setCouponCount(int couponCount) {
        this.couponCount = couponCount;
    }

    public boolean isVip() {
        return vip;
    }

    public void setVip(boolean vip) {
        this.vip = vip;
    }

    public Object getVipIcon() {
        return vipIcon;
    }

    public void setVipIcon(Object vipIcon) {
        this.vipIcon = vipIcon;
    }

    public String getVipName() {
        return vipName;
    }

    public void setVipName(String vipName) {
        this.vipName = vipName;
    }

    public String getStarLevelName() {
        return starLevelName;
    }

    public boolean isRechargeSwitch() {
        return rechargeSwitch;
    }

    public void setRechargeSwitch(boolean rechargeSwitch) {
        this.rechargeSwitch = rechargeSwitch;
    }

    public int getCollectCount() {
        return collectCount;
    }

    public void setCollectCount(int collectCount) {
        this.collectCount = collectCount;
    }

    public String getInviteCode() {
        return inviteCode;
    }

    public void setInviteCode(String inviteCode) {
        this.inviteCode = inviteCode;
    }

    public String getTeamCode() {
        return teamCode;
    }

    public void setTeamCode(String teamCode) {
        this.teamCode = teamCode;
    }

    public String getWool() {
        return BigDecimalUtil.formatZero(wool);
    }

    public void setWool(String wool) {
        this.wool = wool;
    }

    public boolean isHasSafePwd() {
        return hasSafePwd;
    }

    public void setHasSafePwd(boolean hasSafePwd) {
        this.hasSafePwd = hasSafePwd;
    }

    public boolean isIsCertify() {
        return isCertify;
    }

    public void setIsCertify(boolean isCertify) {
        this.isCertify = isCertify;
    }

    public boolean isIsLocationOk() {
        return isLocationOk;
    }

    public void setIsLocationOk(boolean isLocationOk) {
        this.isLocationOk = isLocationOk;
    }

    public int getBusType() {
        return busType;
    }

    public boolean isPartner() {
        return busType==21 || busType==22;
    }

    public void setBusType(int busType) {
        this.busType = busType;
    }

    public String getPhoneStr() {
        if (phone==null){
            return "";
        }
        if (phone.length()<11){
            return phone;
        }
        return phone.substring(0,3)+"****"+phone.substring(7);
    }

    public boolean isShop() {
        return busType==3;
    }

    public void updateParams(Map<String, String> params) {
        //avatar nickname
        String nickname = params.get("nickname");
        if (!TextUtils.isEmpty(nickname)){
            setNickname(nickname);
        }
        String avatar = params.get("avatar");
        if (!TextUtils.isEmpty(avatar)){
            setAvatar(avatar);
        }
    }

    public String getRealNameAfterNikeName() {
        if (TextUtils.isEmpty(realName)){
            return nickname;
        }
        return  realName;
    }

    public String getContribution() {
        return contribution;
    }

    public void setContribution(String contribution) {
        this.contribution = contribution;
    }
}
